package day04;

import java.awt.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

public class be_controlled {

    public static void main(String[] args) throws IOException, AWTException, ClassNotFoundException {

        Socket s = new Socket("192.168.215.110",6200);
        InputStream in = s.getInputStream();
        ObjectInputStream ois = new ObjectInputStream(in);
        for (;;) {
            mouse_info mouse = (mouse_info)ois.readObject();
            int x = mouse.x;
            int y = mouse.y;
            Robot rb = new Robot();
            rb.mouseMove(x, y);
        }

    }
}


/**
 * 1.连接上服务器，控制端
 * 2.获取输入初级流，并包装高级接受流Object
 * 3.接受对方发送的东西，并且转化为鼠标信息
 * 4.取出x,y位置信息，并移动自己的鼠标**/